#ifndef CUSTOMNETWORKMANAGERFACTORY_H
#define CUSTOMNETWORKMANAGERFACTORY_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QSslError>
#include <QDeclarativeNetworkAccessManagerFactory>
#include <QtDeclarative/QDeclarativeEngine>

class CustomNetworkManagerFactory : public QObject, public QDeclarativeNetworkAccessManagerFactory
{
    Q_OBJECT

public:
    explicit CustomNetworkManagerFactory(QObject *parent = 0) { Q_UNUSED(parent) }
    virtual QNetworkAccessManager *create(QObject *parent) {
        m_networkManager = new QNetworkAccessManager(this);
        connect(m_networkManager,SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)),this,SLOT(onIgnoreSSLErrors(QNetworkReply*,QList<QSslError>)));
        return m_networkManager;
    }

public slots:
    void onIgnoreSSLErrors(QNetworkReply* reply,QList<QSslError> error) {
        reply->ignoreSslErrors(error);
    }

private:
    QNetworkAccessManager* m_networkManager;

};

#endif // CUSTOMNETWORKMANAGERFACTORY_H
